package com.example.designpatterns.strategy;

import org.junit.Test;

/**
 * 策略模式de测试
 */
public class STest1 {
    @Test
    public void sTest1(){
        Context context =new Context();
        //第一个策略
        context.setStrategy1(new DiscountsStrategy1());
        System.out.println(context.discounts(100));
        System.out.println("*************");
        //第二个策略
        context.setStrategy1(new DiscountsStrategy2());
        System.out.println(context.discounts(140));
        System.out.println("*************");
        //第三个策略
        context.setStrategy1(new DiscountsStrategy3());
        System.out.println(context.discounts(90));
        System.out.println("*************");
        System.out.println(context.discounts(120));
    }
}
